<?php

// +----------------------------------------------------------------------
// | 骑士虚拟产品寄售商城系统开源版 
// +----------------------------------------------------------------------
// | Copyright (c) 2023-2025 https://www.qqss.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed MIT 本系统开源仅仅是为了新手学习开发商城为目的，使用时请遵循当地法律法规
// +----------------------------------------------------------------------
// | Author: QQSS <990504246@qq.com>
// +----------------------------------------------------------------------

namespace app\service\user;

use app\common\util\TokenAuth;

/**
 * 公共用户服务层
 * class UserService
 * @package app\service\user
 */
class UserService
{

    /**
     * 创建token
     * @param array $user 用户信息
     * @param string $type 场景（admin，merchant）
     * @return array
     */
    public function createToken($user, $type = 'merchant')
    {
        return [
            'access_token' => TokenAuth::createToken($user['id'], $type, $user, 3600 * 24 * 30)['token']
        ];
    }
}
